<?php

namespace App\Http\Requests\Admin\GoodsEorder;

use App\Http\Requests\Request;

class UpdateRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'goods_sn' => 'required',
            //'goods_sn' => 'unique:goods_eorder_info,goods_sn',
            'goods_name' => 'required',
            'goods_spec' => 'required',
            'price' => 'required',
            'ieType' => 'required|in:I,E',
            'stockFlag' => 'required|in:1,2',
            'batchNumbers' => 'required',
            'tradeCountryCiq' => 'required',
            'tradeCountryCus' => 'required',
            'packageTypeCiq' => 'required',
            'packageTypeCus' => 'required',
            'currencyCiq' => 'required',
            'currencyCus' => 'required',
            'unitCiq' => 'required',
            'unitCus' => 'required',
            'originCountryCiq' => 'required',
            'originCountryCus' => 'required',
            'weight' => 'required',
            'transportationWay' => 'required',
            'shipCode' => 'required',
            // 'sec_proportion' => 'required_with:unitCus2|min:1',
            'net_weight' => 'required',
            'item_record_no' => 'required',
            'gcode' => 'required',
            'fir_proportion' => 'required',
            'unitCus1' => 'required',
            'usage' => 'required',
        ];
    }
    public function messages()
    {
        return [
            'goods_sn.required'=>'请填写商品货号',
           // 'goods_sn.unique'=>'该货号已存在',
            'goods_name.required' => '请填写商品名称',
            'goods_spec.required' => '请填写商品规格型号',
            'price.required' => '请填写备案商品价格',
            'batchNumbers.required'=>'请填写批次号',
            'tradeCountryCiq.required'=>'请填写贸易国别（检）',
            'tradeCountryCus.required'=>'请填写贸易国别（关）',
            'packageTypeCiq.required'=>'请填写包装种类（检）',
            'packageTypeCus.required'=>'请填写包装种类（关）',
            'unitCiq.required'=>'请填写计量单位（检）',
            'unitCus.required'=>'请填写计量单位（关）',
            'originCountryCiq.required'=>'请填写原产国（检）',
            'originCountryCus.required'=>'请填写原产国（关）',
            'weight.required'=>'请填毛重（KG）',
            /*'sec_proportion.required_with'=>'请填法定第二数量比例',
            'sec_proportion.min'=>'法定第二数量比例必须大于零',*/
            'net_weight.required'=>'请填写净重（KG）',
            'item_record_no.required'=>'请填写账册备案料号',
            'gcode.required'=>'请填写HS编码',
            'fir_proportion.required'=>'请填写法定第一数量比例',
            'unitCus1.required'=>'请填写法定第一计量单位',
            'usage.required'=>'请填写用途编号',
        ];
    }
}
